package com.subtlman.logframework.controller;

import com.subtlman.logframework.aop.AuditLog;
import com.subtlman.logframework.entity.LogTbl;
import com.subtlman.logframework.mapper.LogMapper;
import com.subtlman.logframework.resp.ServiceResp;
import io.swagger.annotations.Api;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Create: IntelliJ IDEA.
 * @Author: subtlman_ljx
 * @Date: 2022/11/11/23:40
 * @Description: test
 */

@Api(tags = "用户数据接口")
@RestController
@RequestMapping("/api/Test")
public class TestController {

    @Resource
    private LogMapper logMapper;

    @AuditLog
    @GetMapping("/getlists")
    public ServiceResp<?> getLists() {
        return ServiceResp.getInstance().success("GetMapping_test");
    }

    @AuditLog
    @PostMapping("/postlists")
    public ServiceResp<?> postLists(@Validated @RequestBody LogTbl tbl) {
        logMapper.insert(tbl);
        return ServiceResp.getInstance().success("PostMapping_test");
    }

}
